<?php 
session_start();
$Is_HO=$_SESSION['branchtype'];
require_once("include/authen.php");
require_once("include/ui.php");

// show header
if ($Is_HO==1)
	echo headerPage("Check Return Product");
else 
	echo headerPage("Return Product");	
?>
 <SCRIPT src="js/js_return.js"></SCRIPT> 
 <script>
$(function() {

	$( "#txtDateFrom" ).datepicker({ dateFormat: 'dd/mm/yy',
		showOn: "button",
		showOn: "button",
		changeMonth: true,
		changeYear: true,
		yearRange:'c-10:c+1',			
		buttonImage: "images/Calendar.png",
		buttonImageOnly: true });
				
	$( "#txtDateTo" ).datepicker({ dateFormat: 'dd/mm/yy',
		showOn: "button",
		showOn: "button",
		changeMonth: true,
		changeYear: true,
		yearRange:'c-10:c+1',			
		buttonImage: "images/Calendar.png",
		buttonImageOnly: true });
		
	$("#btnPrint").live('click',function(){
		$("#normal-screen").hide();
		$("#page-header").hide();
		 
		$(".toolbar-box").hide();
		$("#foolter_table").hide();
		$("#leftboder").hide();
		$("#rightboder").hide();
		$("#searchdata").hide();
		window.print();
		
		$("#normal-screen").show();
		$("#page-header").show();
		$("#searchdata").show();
		$(".toolbar-box").show();
		$("#foolter_table").show();
		$("#leftboder").show();
		$("#rightboder").show();
	});
	
});
</script>
<FORM id="Act" action="return_view.php" method="post"> 
<INPUT type=hidden value="add" id="mode" name="mode"> 
<INPUT type=hidden value="" id="reID" name="reID"> 
<INPUT type=hidden value="" id="type" name="type"> 
<INPUT type=hidden value="" id="branch" name="branch"> 

<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="10" id='leftboder' style="border-left:2px solid #facb0c;">&nbsp;</td>
    <td width="1004" valign="top">
        <div class="content-box">
            <div Class="toolbar-box">   
                <div class="t">
                    <div class="t">
                        <div class="t"></div>
                    </div>
                 </div>
                 <div class="m">
                    <div class="toolbar">
                        <table class="toolbar">
                        <tr>
                            <td>	
								<?php  if (($Is_HO==0)  && ($_SESSION["permission"][$returnScreen]["Edit"]=="1")) {?>
								<a href="javascript:void('0');" id="btnAdd">
								<span class="icon_add"></span>Add
								</a>
								<?php } else echo "&nbsp;";?>
							</td>
					        <td>
								<a href="javascript:void('0');" title="Print" id="btnPrint">
								<span class="icon_Print"></span>Print
								</a>
							</td>							
                        </tr>
                        </table>
                    </div>
                      <div class="header" style="background-image: url(images/return.png);">
						<?php  if ($Is_HO==1) {?>
							Check Return Product
						<?php  }else{ ?>
							Return Product
						<?php  }?>
                      </div>
                <div class="clr"></div>
                 </div>
                 <div class="b">
                    <div class="b">
                        <div class="b"></div>
                    </div>
                 </div>
            </div>
               <div id="element-box">
                <div class="t">
					<div class="t">
						<div class="t"></div>
					</div>
				</div>
                <div class="m">
                    <table width="100%" id='searchdata'>
                        <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">
                            Return Code : 
                            </td>
							<td width="85%" align=left >
							<input id="txtReturnCode"  title="Filter by Code "  type="text"  	size=40 name="txtReturnCode" class="boxItem" />
							</td>
                         </tr>
						<?php if ($Is_HO==1){?>
                        <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">
                            Branch Name : 
                            </td>
							<td width="85%" align=left >
							 <select id="cboBranchName" style="width:13em;"></select>
							</td>
                         </tr>	
						<?php }?>
                        <!--tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">
                            Return Type : 
                            </td>
							<td width="85%" align=left >
							 <select id="cboReturnType" style="width:13em;">
								 <option value="0" selected>All</option>
								<option value="1">Normal</option>
								<option value="2">Defect</option>
							 </select>
							</td>
                         </tr-->
                        <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">
                            Return Date : 
                            </td>
							<td width="85%" align=left >
								<input id="txtDateFrom"  title="Filter by Received Date " type="text" size=10 name="txtDateFrom" class="boxItem" />
								&nbsp;- <input id="txtDateTo"  title="Filter by Received Date " type="text" size=10 name="txtDateTo" class="boxItem" />
							 
							</td>
                        </tr>	
                       <tr>
                            <td width="15%" class="fontSearch" style="padding-left:20">
                            Status : 
                            </td>
							<td width="85%" align=left >
							<select id="cboStatus" style="width:10em;">
							<option value="0" selected>All</option>
							<?php  if ($Is_HO==0) {?>
							<option value="1">Created</option>
							<?php  }?>
							<option value="2">Return</option>
							<option value="3">Closed</option>
							</select>
							</td>
                         </tr>						 
						 <tr><td/><td>
						 <a href="javascript:void('0');" id="btnSearch"><img src="./images/btn-search.gif" border=0/></a> </td></tr>
						 <tr><td colspan="2"></tr>
                    </table>
                    <table cellspacing="1" id="resultData" class=list>
                    <thead>
                       <tr>
								<th width="4%">#</th>
								<th style="display:none">id</th>
								<th style="display:none">branchid</th>
								<th class="title" width="8%" >Code</th>
								<?php if ($Is_HO==1){?>
									<th class="title" width="22%">Branch Name</th>
								<?php }?>
								<th  class="title" width="15%" nowrap="nowrap">Return Date</th>
								<th  class="title" width="8%" nowrap="nowrap">Status</th>
								<th  class="title" width="6%" nowrap="nowrap">Amounts</th>
								<th  class="title" width="15%" nowrap="nowrap">Remark</th>
								<th  class="title" width="5%" nowrap="nowrap">Check</th>
								<?php if ($Is_HO==0){?>
								<th  class="title" width="5%" nowrap="nowrap">Edit</th>
								<?php }?>
								<th  class="title" width="5%" nowrap="nowrap">Del</th>
                      </tr>
                    </thead>
                   <tbody>
                     </tbody>
                     <tfoot>
                         <tr>
							<td colspan="9">
							<div class="boxfooter">
								<div class="totalpage">Total : <span id="rowCount"></span>&nbsp;&nbsp;rows</div>
								<div id="paging_button"></div>
							</div>
                         </tr>
                     </tfoot>
                    </table>
                  <div class="clr"></div>
                </div>
                 <div class="b"><div class="b"><div class="b"></div></div></div>
                 <div class="clr"></div>
                </div> <!-- elementbox-->
        </div>
    </td>
    <td width="10" id='rightboder' style="border-right:2px solid #facb0c;">&nbsp;</td>
  </tr>
</table>
 </FORM>
 
<div id="dialog-confirm" title="Confirm delete?" style="padding-top:20px;">
	<p style="font-size:13px"><span class="ui-icon ui-icon-alert" 
		style="float:left; margin:0 7px 20px 0;">
		</span>Are you sure to delete these return product?</p>
</div>
<div id="dialog-form" style='height:550px'>
<p class="validateTips">* fields are required.</p>
 
	<table cellpadding="0" cellspacing="0" border="0" width="100%" class="fieldset">
		<tr>
			<td width="15%"><label for="name" >&nbsp;Return Code *</label></td>
			<td width="85%"><input type="text" name="Code"  id="Code" class="text ui-widget-content ui-corner-all" /></td>
		</tr>
		<tr>
			<td width="15%"><label for="name" >&nbsp;Remark</label></td>
			<td width="85%"><textarea  name="Remark"  id="Remark" rows="3" cols="90" class="text ui-widget-content ui-corner-all" ></textarea></td>
		</tr>
		<tr>
			<td colspan="2" style="padding-top:10px;">
				<fieldset  class="ui-widget ui-widget-content">
					<legend><label id="lblGroup">Please select Product</label></legend>
					<div class="ui-widget" style="font-size:12px;height:30px;padding-top:10px;">
							<label><span id="lblTitle">Product: </span>
								<select name="productlist" id="productlist" style="width:15em;line-height:30px;">
								</select>&nbsp;&nbsp;
								Amount: &nbsp;
								<input type="text" name="Amount" style="width:10%;padding:5px;font-size:12px;" maxlength=5  id="Amount" class="ui-widget-content ui-corner-all" />
								&nbsp;&nbsp;&nbsp;&nbsp;
								<span id="lblTitle">Type: </span>
								<input type="radio" id="A" name="Type" id="Type_1" checked value="1"><label for="Type_1">Normal</label>
								<input type="radio" id="B" name="Type" id="Type_2" value="2"> <label for="Type_2">Defect</label>
								&nbsp;&nbsp;&nbsp;&nbsp;
								<button id="btnAddProduct" style="font-size:12px">Add</button>
							</label>
					</div>
					<table id="tbNewProduct" cellspacing="1" width="100%" cellpadding="3" border="0" style="background-color:#f9f9f9;font-size:12px;border:1px solid #EAEAEA;">
					<thead>
						<tr style="background-color:#CCC;font-weight:bold;">
							<th width="10%">Product ID</th>
							<th width="30%">Product Name</th>
							<th width="15%">Unit</th>
							<th width="15%">Amount</th>
							<th width="15%">Type</th>
							<th width="5%">Del</th>
						</tr>
					</thead>
					<tbody style="font-weight:normal;background-color:#fff">
					</tbody>
					<tfoot>
						<tr>
							<td colspan="6" align="left" style="font-size:11px;font-weight:bold;">Counts: <span id='iCount' style="color:red">0</span></td>
						</tr>
					</tfoot>
					</table>
				</fieldset>
			</td>
		</tr>
	</table>
 
</div>
<?php echo footer();?>